import store from '@/store/index'
import request from '@/utils/request'
// 频道-用户已选列表
export const getUserChannelAPI = () => request({
  url: '/v1_0/user/channels',
  headers: {
    Authorization: `Bearer ${store.state.user.token}`
  }
})

// 获取文章频道列表
export const getArticleListAPI = ({ channelId, timestamp = Date.now() }) => {
  return request({
    method: 'GET',
    url: '/v1_0/articles',
    params: {
      channel_id: channelId,
      timestamp
    }
  })
}

// 文章-不感兴趣
export const articleDislikeAPi = ({ artId }) => {
  return request({
    method: 'POST',
    url: '/v1_0/article/dislikes',
    headers: {
      Authorization: `Bearer ${store.state.user.token}`
    },
    data: {
      target: artId
    }
  })
}

// 首页-文章举报
export const articleReportAPI = ({ artId, type, remark }) => {
  return request({
    method: 'POST',
    url: '/v1_0/article/reports',
    headers: {
      Authorization: `Bearer ${store.state.user.token}`
    },
    data: {
      target: artId,
      type: type,
      remark: remark
    }
  })
}
